package com.mgface.gateway.interceptor;

import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author wanyuxiang
 * @version 1.0
 * @project dubbo
 * @create 2018-08-15 11:34
 **/
public class RequestInterceptor extends HandlerInterceptorAdapter {
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        String token = request.getParameter("token");
        if ("1".equals(token)){
            return true;
        }else {
            response.getWriter().write("token error");
            return false;
        }
    }
}
